package com.hqyj.dao;


import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface UserInfoDao {

    //登录方法
    //查询用户名
    @Select("select count(userName) from userinfo where userName=#{userName};")
    int Search_username(String userName );

    //查询密码
    @Select("select count(userPwd) from userinfo where userPwd=#{userPwd}")
    int Search_userPwd(@Param("userPwd") String userPwd);

    @Select("select count(userPwd) from userinfo where userPwd=#{userPwd}")
    String Return_userPwd(@Param("userPwd") String userPwd);

    //查询邮箱
    @Select("select count(email) from userinfo where email=#{email}")
    int Search_email(@Param("email") String email);

    //注册
    @Insert("INSERT INTO  userinfo(userName,userPwd,email) VALUE (#{userName},#{userPwd},#{email});")
    int zhuce(@Param("userName")String userName, @Param("userPwd")String userPwd, @Param("email")String email);

    //验证邮箱
    @Update("UPDATE userinfo SET userPwd =#{userPwd} WHERE email = #{email}")
    int Change_email(@Param("userPwd") String userPwd, @Param("email") String email);


    //登陆方法
    @Select("select count(*) from userinfo where userName=#{userName} and userPwd=#{userPwd}")
    int login(@Param("userName") String userName, @Param("userPwd") String userPwd);

    @Update("UPDATE userinfo SET userPwd =#{userPwd} WHERE email = #{email}")
    String change(@Param("userPwd") String userPwd);

//    @Select("SELECT areaName FROM info WHERE provinceName=#{provinceName} and code < 478 AND areaName!=''")
//    List<String> selectCha(@Param("provinceName")String provinceName);
//
//    @Select("SELECT confirmCount,curedCount,deadCount FROM info WHERE areaName=#{areaName} and code < 478")
//    List<InfoDao> selectShen(@Param("areaName")String areaName);
}